package com.qzsoft.system.modules.permission.dept.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzsoft.jeemis.repository.sqlmapper.SqlMapper;
import com.qzsoft.system.repository.sys.entity.SysDeptEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.session.SqlSession;

import java.util.List;
import java.util.Map;

/**
 * (SysDeptJob)表数据库访问层
 *
 * @author yzz
 * @since 2020-07-30 09:42:35
 */
@Mapper
public interface SysDeptMapper extends BaseMapper<SysDeptEntity> {

    IPage<SysDeptEntity> findPage(IPage page, @Param("param")SysDeptEntity dto);
    List<Map<String,Object>> getDeptUser(Map<String,Object> map);
    List<Map<String,Object>> getUserInfo(Map<String,Object> map);


    /**
     * 批量更新
     * @param list
     * @return
     */
    int updateBatchById(@Param("list")List<SysDeptEntity> list);

    /**
     * 根据机构ID查询该机构下岗位数
     * @param deptId
     * @return
     */
    int selectJobCountByDeptId(@Param("deptId")String deptId);

    /**
     * 根据机构编码查询该机构下人数
     * @param deptCode
     * @return
     */
    int selectPersonCountByDeptCode(@Param("deptCode")String deptCode);


    void updateHasLeafById(@Param("id") String id);

    SysDeptEntity getRealId(String id);

    SysDeptEntity getDeptByCode(String code);
}